class_name HoldExpPotion
extends BaseHoldItem


func use():
	var player = holder as Player
	
	var old_level = GlobalData.player_data.level
	GlobalData.player_data.add_exp(item_data.item_config.add_exp)
	var new_level = GlobalData.player_data.level
	GlobalSignals.player_info_changed.emit()
	player.level.emit_particle("particle_add_exp_effect", player.ray_cast_point.global_position)
	
	if new_level != old_level:
		var particle_inst = (ResourceManager.get_resource("particle_level_up") as PackedScene).instantiate()
		player.particles_parent.add_child(particle_inst)
		particle_inst.position = Vector2(0, 6)
